package com.luych.toolbox.data.service.constant;

import com.luych.toolbox.common.enums.DataSourceType;
import com.luych.toolbox.data.service.core.dm.DmDataType;
import com.luych.toolbox.data.service.core.mysql.MysqlDataType;
import com.luych.toolbox.data.service.entity.DataTypeSetting;

import java.util.Arrays;
import java.util.List;

public class Constant {


    public static final List<DataTypeSetting> DATA_TYPE_SETTINGS = Arrays.asList(
            // MySQL -> DM
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.TEXT, DataSourceType.DM, DmDataType.TEXT),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.MEDIUMTEXT, DataSourceType.DM, DmDataType.TEXT),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.LONGTEXT, DataSourceType.DM, DmDataType.TEXT),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.JSON, DataSourceType.DM, DmDataType.TEXT),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.TINYBLOB, DataSourceType.DM, DmDataType.BLOB),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.MEDIUMBLOB, DataSourceType.DM, DmDataType.BLOB),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.LONGBLOB, DataSourceType.DM, DmDataType.BLOB),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.DEC, DataSourceType.DM, DmDataType.DECIMAL),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.NUMERIC, DataSourceType.DM, DmDataType.DECIMAL),
            new DataTypeSetting(DataSourceType.MYSQL, MysqlDataType.INTEGER, DataSourceType.DM, DmDataType.INT),
            // DM -> MySQL
            new DataTypeSetting(DataSourceType.DM, DmDataType.REAL, DataSourceType.MYSQL, MysqlDataType.FLOAT),
            new DataTypeSetting(DataSourceType.DM, DmDataType.CLOB, DataSourceType.MYSQL, MysqlDataType.LONGTEXT),

            new DataTypeSetting(DataSourceType.DM, DmDataType.DEC, DataSourceType.MYSQL, MysqlDataType.DECIMAL),
            new DataTypeSetting(DataSourceType.DM, DmDataType.NUMERIC, DataSourceType.MYSQL, MysqlDataType.DECIMAL),
            new DataTypeSetting(DataSourceType.DM, DmDataType.NUMBER, DataSourceType.MYSQL, MysqlDataType.DECIMAL),
            new DataTypeSetting(DataSourceType.DM, DmDataType.INTEGER, DataSourceType.MYSQL, MysqlDataType.INT)
    );

    public static final String USER_DELETED = "已注销";

    public static final String DATA_TABLE_NOT_FOUND = "数据表不存在";
    public static final String DATA_COLUMN_NOT_FOUND = "数据字段不存在";
    public static final String DATA_SOURCE_NOT_FOUND = "数据源不存在";
    public static final String DATA_SOURCE_SAVE_NAME_USED = "该数据源名称已经被使用，请重新填写";
    public static final String DATA_SOURCE_SAVE_OWNER_ERROR = "未找到该数据源的责任人信息";
    public static final String DATA_SOURCE_CLONE_NAME_USED = "该数据源名称已经被使用，请重新填写";
    public static final String DATA_SOURCE_DELETE_REJECT_USED_BY_PROJECT = "该数据源已经被数据项目使用，无法删除";
    public static final String DATA_SOURCE_DELETE_REJECT_USED_BY_BACKUP_PLAN = "该数据源已经被备份计划使用，无法删除";
    public static final String DATA_SOURCE_DELETE_REJECT_USED_BY_BACKUP_HISTORY = "该数据源已经被备份任务使用，无法删除";
    public static final String DATA_SOURCE_DELETE_REJECT_USED_BY_COMPARE_PLAN = "该数据源已经被对比计划使用，无法删除";
    public static final String DATA_SOURCE_DELETE_REJECT_USED_BY_COMPARE_HISTORY = "该数据源已经被对比任务使用，无法删除";

    public static final String DATA_AGENT_NOT_FOUND = "数据代理不存在";
    public static final String DATA_AGENT_SAVE_NAME_USED = "该数据代理名称已经被使用，请重新填写";
    public static final String DATA_AGENT_DELETE_REJECT_USED = "该数据代理已经被使用，无法删除";

    public static final String DATA_PROJECT_NOT_FOUND = "数据项目不存在";
    public static final String DATA_PROJECT_SAVE_NAME_USED = "该数据项目名称已经被使用，请重新填写";
    public static final String DATA_PROJECT_DELETE_REJECT_USED = "该数据项目已经被使用，无法删除";
    public static final String DATA_PROJECT_INIT_STATUS_ERROR = "当前状态下无法执行初始化操作，请稍后再试";
    public static final String DATA_PROJECT_UPGRADE_STATUS_ERROR = "当前状态下无法执行升级操作，请稍后再试";
    public static final String DATA_PROJECT_ENABLE_STATUS_ERROR = "当前状态下无法执行启用操作，请稍后再试";
    public static final String DATA_PROJECT_DISABLE_STATUS_ERROR = "当前状态下无法执行停用操作，请稍后再试";

    public static final String DATA_BACKUP_PLAN_NOT_FOUND = "数据备份计划不存在";
    public static final String DATA_BACKUP_PLAN_SAVE_CRON_ERROR = "CRON表达式格式错误，请重新填写";
    public static final String DATA_BACKUP_PLAN_SAVE_FILE_USED = "该数据代理下已经存在备份文件前缀为%s的备份计划，请重新填写备份文件前缀";
    public static final String DATA_BACKUP_PLAN_ENABLE_STATUS_ERROR = "当前状态下无法执行启用操作，请稍后再试";
    public static final String DATA_BACKUP_PLAN_DISABLE_STATUS_ERROR = "当前状态下无法执行停用操作，请稍后再试";
    public static final String DATA_BACKUP_PLAN_DELETE_REJECT_USED = "该数据备份计划已经被使用，无法删除";

    public static final String DATA_BACKUP_HISTORY_NOT_FOUND = "数据备份历史不存在";
    public static final String DATA_BACKUP_HISTORY_SAVE_FILE_USED = "该数据代理下已经存在备份文件为%s的备份历史，请重新填写备份文件";
    public static final String DATA_BACKUP_HISTORY_MODIFY_REJECT = "数据备份历史不支持修改操作";
    public static final String DATA_BACKUP_HISTORY_DELETE_REJECT_USED = "该数据备份历史已经被使用，无法删除";

    public static final String DATA_RECOVERY_HISTORY_NOT_FOUND = "数据恢复历史不存在";
    public static final String DATA_RECOVERY_HISTORY_MODIFY_REJECT = "数据恢复历史不支持修改操作";

    public static final String DATA_COMPARE_PLAN_NOT_FOUND = "数据对比计划不存在";
    public static final String DATA_COMPARE_PLAN_SAVE_CRON_ERROR = "CRON表达式格式错误，请重新填写";
    public static final String DATA_COMPARE_PLAN_ENABLE_STATUS_ERROR = "当前状态下无法执行启用操作，请稍后再试";
    public static final String DATA_COMPARE_PLAN_DISABLE_STATUS_ERROR = "当前状态下无法执行停用操作，请稍后再试";
    public static final String DATA_COMPARE_PLAN_DELETE_REJECT_USED = "该数据对比计划已经被使用，无法删除";

    public static final String DATA_COMPARE_HISTORY_NOT_FOUND = "数据对比历史不存在";
    public static final String DATA_COMPARE_HISTORY_MODIFY_REJECT = "数据对比历史不支持修改操作";
    public static final String DATA_COMPARE_SETTING_EXPRESSION_EXCEPTION = "数据对比设置表达式格式不正确，需要：%s，提供：%s";

    public static final String DATA_TRANSPORTER_PLAN_NOT_FOUND = "数据同步计划不存在";
    public static final String DATA_TRANSPORTER_HISTORY_NOT_FOUND = "数据同步历史不存在";
    public static final String DATA_TRANSPORTER_HISTORY_EXECUTE_ERROR_TABLES_NO_EQUAL = "来源数据源和目标数据源的数据表数量不一致";
    public static final String DATA_TRANSPORTER_HISTORY_EXECUTE_ERROR_FROM_TABLE_NOT_FOUND = "来源数据源中未找到表：%s";
    public static final String DATA_TRANSPORTER_HISTORY_EXECUTE_ERROR_TO_TABLE_NOT_FOUND = "目标数据源中未找到表：%s";

    public static final String DATA_UPGRADE_NOT_FOUND = "数据更改记录不存在";

    public static final String DATA_UPGRADE_DETAIL_NOT_FOUND = "数据更改详情不存在";
}
